﻿Imports System.Data.SqlClient
Imports MySql.Data.MySqlClient

Public Class frmTS_Taisan
    Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents btnNew As System.Windows.Forms.Button
    Friend WithEvents btnSave As System.Windows.Forms.Button
    Friend WithEvents btnDelete1 As System.Windows.Forms.Button
    Friend WithEvents txtten As System.Windows.Forms.TextBox
    Friend WithEvents txtma As System.Windows.Forms.TextBox
    Friend WithEvents txtnuocsx As System.Windows.Forms.TextBox
    Friend WithEvents BtnClose As System.Windows.Forms.Button
    ' Friend WithEvents DataGridView1 As System.Windows.Forms.DataGridView
    Friend WithEvents DataGridView1 As MyDataGridView
    Friend WithEvents MatinhDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents TentinhDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents MamienDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents DataSetFormDonBindingSource As System.Windows.Forms.BindingSource
    Friend WithEvents DataSetForm_Don As MEKONG.DataSetForm_Don
    Friend WithEvents Manhom As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents Tennhom As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents ghichu As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents TStaisanBindingSource As System.Windows.Forms.BindingSource
    Friend WithEvents MaDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents TenDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents MapbDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents TenpbDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents NuocsxDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents NguyengiaDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents TylekhDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents MuckhDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents SokykhDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents NgaysdDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents thang_dau_kh As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents taikhoan_ts As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents taikhoan_kh As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents taikhoan_cp As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents txttennhom As System.Windows.Forms.TextBox
    Friend WithEvents btn_cbo_nhom_taisan As System.Windows.Forms.Button
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents btn_cbo_mapb As System.Windows.Forms.Button
    Friend WithEvents txttenpb As System.Windows.Forms.TextBox
    Friend WithEvents txtnguyengia As System.Windows.Forms.TextBox
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents txttylekh As System.Windows.Forms.TextBox
    Friend WithEvents Label9 As System.Windows.Forms.Label
    Friend WithEvents txtmuckh As System.Windows.Forms.TextBox
    Friend WithEvents Label10 As System.Windows.Forms.Label
    Friend WithEvents txtsokykh As System.Windows.Forms.TextBox
    Friend WithEvents Label11 As System.Windows.Forms.Label
    Friend WithEvents Label12 As System.Windows.Forms.Label
    Friend WithEvents txtthang_dau_kh As System.Windows.Forms.TextBox
    Friend WithEvents Label13 As System.Windows.Forms.Label
    Friend WithEvents btn_cbo_taikhoan As System.Windows.Forms.Button
    Friend WithEvents Cbotaikhoan_ts As MTGCComboBox
    Friend WithEvents Cbotaikhoan_kh As MTGCComboBox
    Friend WithEvents Label14 As System.Windows.Forms.Label
    Friend WithEvents Cbotaikhoan_cp As MTGCComboBox
    Friend WithEvents Label15 As System.Windows.Forms.Label
    Friend WithEvents Label16 As System.Windows.Forms.Label
    Friend WithEvents txtghichu As System.Windows.Forms.TextBox
    Friend WithEvents cbomanhom As MTGCComboBox
    Friend WithEvents cbomapb As MTGCComboBox
    Friend WithEvents txtngaysd As System.Windows.Forms.MaskedTextBox
    Friend WithEvents txtDVT As System.Windows.Forms.TextBox
    Friend WithEvents Label17 As System.Windows.Forms.Label
    Friend WithEvents colma As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents colten As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents coldvt As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents colmapb As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents coltenpb As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents colnuocsx As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents colnguyengia As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents coltylekh As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents colmuckh As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents colsokykh As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents colngaysd As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents colthang_dau_kh As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents coltaikhoan_ts As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents coltaikhoan_kh As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents coltaikhoan_cp As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents colmanhom As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents coltennhom As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents colghichu As System.Windows.Forms.DataGridViewTextBoxColumn
    Friend WithEvents Btn_Lamtuoi As System.Windows.Forms.Button
    Friend WithEvents Btn_Edit As System.Windows.Forms.Button
    Friend WithEvents BtnIn As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmTS_Taisan))
        Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle
        Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle
        Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle
        Dim DataGridViewCellStyle4 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle
        Dim DataGridViewCellStyle5 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle
        Me.btnSave = New System.Windows.Forms.Button
        Me.txtnuocsx = New System.Windows.Forms.TextBox
        Me.Label4 = New System.Windows.Forms.Label
        Me.txtten = New System.Windows.Forms.TextBox
        Me.Label3 = New System.Windows.Forms.Label
        Me.txtma = New System.Windows.Forms.TextBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label1 = New System.Windows.Forms.Label
        Me.btnNew = New System.Windows.Forms.Button
        Me.btnDelete1 = New System.Windows.Forms.Button
        Me.BtnClose = New System.Windows.Forms.Button
        Me.BtnIn = New System.Windows.Forms.Button
        Me.MaDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.TenDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.MapbDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.TenpbDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.NuocsxDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.NguyengiaDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.TylekhDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.MuckhDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.SokykhDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.NgaysdDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.thang_dau_kh = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.taikhoan_ts = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.taikhoan_kh = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.taikhoan_cp = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.Label5 = New System.Windows.Forms.Label
        Me.txttennhom = New System.Windows.Forms.TextBox
        Me.btn_cbo_nhom_taisan = New System.Windows.Forms.Button
        Me.Label6 = New System.Windows.Forms.Label
        Me.btn_cbo_mapb = New System.Windows.Forms.Button
        Me.txttenpb = New System.Windows.Forms.TextBox
        Me.txtnguyengia = New System.Windows.Forms.TextBox
        Me.Label7 = New System.Windows.Forms.Label
        Me.Label8 = New System.Windows.Forms.Label
        Me.txttylekh = New System.Windows.Forms.TextBox
        Me.Label9 = New System.Windows.Forms.Label
        Me.txtmuckh = New System.Windows.Forms.TextBox
        Me.Label10 = New System.Windows.Forms.Label
        Me.txtsokykh = New System.Windows.Forms.TextBox
        Me.Label11 = New System.Windows.Forms.Label
        Me.Label12 = New System.Windows.Forms.Label
        Me.txtthang_dau_kh = New System.Windows.Forms.TextBox
        Me.Label13 = New System.Windows.Forms.Label
        Me.btn_cbo_taikhoan = New System.Windows.Forms.Button
        Me.Cbotaikhoan_ts = New MTGCComboBox
        Me.Cbotaikhoan_kh = New MTGCComboBox
        Me.Label14 = New System.Windows.Forms.Label
        Me.Cbotaikhoan_cp = New MTGCComboBox
        Me.Label15 = New System.Windows.Forms.Label
        Me.Label16 = New System.Windows.Forms.Label
        Me.txtghichu = New System.Windows.Forms.TextBox
        Me.cbomanhom = New MTGCComboBox
        Me.cbomapb = New MTGCComboBox
        Me.txtngaysd = New System.Windows.Forms.MaskedTextBox
        Me.TStaisanBindingSource = New System.Windows.Forms.BindingSource(Me.components)
        Me.DataSetForm_Don = New MEKONG.DataSetForm_Don
        Me.DataSetFormDonBindingSource = New System.Windows.Forms.BindingSource(Me.components)
        Me.DataGridView1 = New MEKONG.MyDataGridView
        Me.colma = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.colten = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.coldvt = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.colmapb = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.coltenpb = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.colnuocsx = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.colnguyengia = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.coltylekh = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.colmuckh = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.colsokykh = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.colngaysd = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.colthang_dau_kh = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.coltaikhoan_ts = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.coltaikhoan_kh = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.coltaikhoan_cp = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.colmanhom = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.coltennhom = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.colghichu = New System.Windows.Forms.DataGridViewTextBoxColumn
        Me.txtDVT = New System.Windows.Forms.TextBox
        Me.Label17 = New System.Windows.Forms.Label
        Me.Btn_Lamtuoi = New System.Windows.Forms.Button
        Me.Btn_Edit = New System.Windows.Forms.Button
        CType(Me.TStaisanBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.DataSetForm_Don, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.DataSetFormDonBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'btnSave
        '
        Me.btnSave.BackColor = System.Drawing.Color.Transparent
        Me.btnSave.Image = CType(resources.GetObject("btnSave.Image"), System.Drawing.Image)
        Me.btnSave.Location = New System.Drawing.Point(240, 150)
        Me.btnSave.Name = "btnSave"
        Me.btnSave.Size = New System.Drawing.Size(85, 24)
        Me.btnSave.TabIndex = 4
        Me.btnSave.UseVisualStyleBackColor = False
        '
        'txtnuocsx
        '
        Me.txtnuocsx.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtnuocsx.Location = New System.Drawing.Point(603, 63)
        Me.txtnuocsx.MaxLength = 100
        Me.txtnuocsx.Name = "txtnuocsx"
        Me.txtnuocsx.Size = New System.Drawing.Size(395, 22)
        Me.txtnuocsx.TabIndex = 3
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(7, 66)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(54, 16)
        Me.Label4.TabIndex = 16
        Me.Label4.Text = "Mã BP"
        Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'txtten
        '
        Me.txtten.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtten.Location = New System.Drawing.Point(217, 36)
        Me.txtten.MaxLength = 50
        Me.txtten.Name = "txtten"
        Me.txtten.Size = New System.Drawing.Size(324, 22)
        Me.txtten.TabIndex = 2
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(164, 38)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(52, 17)
        Me.Label3.TabIndex = 14
        Me.Label3.Text = "Tên TS"
        '
        'txtma
        '
        Me.txtma.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtma.Location = New System.Drawing.Point(77, 36)
        Me.txtma.MaxLength = 10
        Me.txtma.Name = "txtma"
        Me.txtma.Size = New System.Drawing.Size(85, 22)
        Me.txtma.TabIndex = 1
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(8, 38)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(57, 16)
        Me.Label2.TabIndex = 12
        Me.Label2.Text = "Mã TS"
        Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'Label1
        '
        Me.Label1.BackColor = System.Drawing.Color.Transparent
        Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.Location = New System.Drawing.Point(348, 1)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(245, 24)
        Me.Label1.TabIndex = 11
        Me.Label1.Text = "DANH MỤC TÀI SẢN"
        '
        'btnNew
        '
        Me.btnNew.Image = CType(resources.GetObject("btnNew.Image"), System.Drawing.Image)
        Me.btnNew.Location = New System.Drawing.Point(152, 150)
        Me.btnNew.Name = "btnNew"
        Me.btnNew.Size = New System.Drawing.Size(85, 24)
        Me.btnNew.TabIndex = 5
        '
        'btnDelete1
        '
        Me.btnDelete1.Image = CType(resources.GetObject("btnDelete1.Image"), System.Drawing.Image)
        Me.btnDelete1.Location = New System.Drawing.Point(419, 150)
        Me.btnDelete1.Name = "btnDelete1"
        Me.btnDelete1.Size = New System.Drawing.Size(85, 24)
        Me.btnDelete1.TabIndex = 29
        '
        'BtnClose
        '
        Me.BtnClose.Image = CType(resources.GetObject("BtnClose.Image"), System.Drawing.Image)
        Me.BtnClose.Location = New System.Drawing.Point(688, 150)
        Me.BtnClose.Name = "BtnClose"
        Me.BtnClose.Size = New System.Drawing.Size(85, 24)
        Me.BtnClose.TabIndex = 30
        '
        'BtnIn
        '
        Me.BtnIn.Image = CType(resources.GetObject("BtnIn.Image"), System.Drawing.Image)
        Me.BtnIn.Location = New System.Drawing.Point(509, 150)
        Me.BtnIn.Name = "BtnIn"
        Me.BtnIn.Size = New System.Drawing.Size(85, 24)
        Me.BtnIn.TabIndex = 39
        '
        'MaDataGridViewTextBoxColumn
        '
        Me.MaDataGridViewTextBoxColumn.DataPropertyName = "ma"
        Me.MaDataGridViewTextBoxColumn.HeaderText = "Mã TS"
        Me.MaDataGridViewTextBoxColumn.Name = "MaDataGridViewTextBoxColumn"
        '
        'TenDataGridViewTextBoxColumn
        '
        Me.TenDataGridViewTextBoxColumn.DataPropertyName = "ten"
        Me.TenDataGridViewTextBoxColumn.HeaderText = "Tên TS"
        Me.TenDataGridViewTextBoxColumn.Name = "TenDataGridViewTextBoxColumn"
        '
        'MapbDataGridViewTextBoxColumn
        '
        Me.MapbDataGridViewTextBoxColumn.DataPropertyName = "mapb"
        Me.MapbDataGridViewTextBoxColumn.HeaderText = "Mã BP"
        Me.MapbDataGridViewTextBoxColumn.Name = "MapbDataGridViewTextBoxColumn"
        '
        'TenpbDataGridViewTextBoxColumn
        '
        Me.TenpbDataGridViewTextBoxColumn.DataPropertyName = "tenpb"
        Me.TenpbDataGridViewTextBoxColumn.HeaderText = "Tên BP"
        Me.TenpbDataGridViewTextBoxColumn.Name = "TenpbDataGridViewTextBoxColumn"
        '
        'NuocsxDataGridViewTextBoxColumn
        '
        Me.NuocsxDataGridViewTextBoxColumn.DataPropertyName = "nuocsx"
        Me.NuocsxDataGridViewTextBoxColumn.HeaderText = "Nước SX"
        Me.NuocsxDataGridViewTextBoxColumn.Name = "NuocsxDataGridViewTextBoxColumn"
        '
        'NguyengiaDataGridViewTextBoxColumn
        '
        Me.NguyengiaDataGridViewTextBoxColumn.DataPropertyName = "nguyengia"
        Me.NguyengiaDataGridViewTextBoxColumn.HeaderText = "Nguyên giá"
        Me.NguyengiaDataGridViewTextBoxColumn.Name = "NguyengiaDataGridViewTextBoxColumn"
        '
        'TylekhDataGridViewTextBoxColumn
        '
        Me.TylekhDataGridViewTextBoxColumn.DataPropertyName = "tylekh"
        Me.TylekhDataGridViewTextBoxColumn.HeaderText = "Tỷ lệ KH"
        Me.TylekhDataGridViewTextBoxColumn.Name = "TylekhDataGridViewTextBoxColumn"
        '
        'MuckhDataGridViewTextBoxColumn
        '
        Me.MuckhDataGridViewTextBoxColumn.DataPropertyName = "muckh"
        Me.MuckhDataGridViewTextBoxColumn.HeaderText = "Mức KH"
        Me.MuckhDataGridViewTextBoxColumn.Name = "MuckhDataGridViewTextBoxColumn"
        '
        'SokykhDataGridViewTextBoxColumn
        '
        Me.SokykhDataGridViewTextBoxColumn.DataPropertyName = "sokykh"
        Me.SokykhDataGridViewTextBoxColumn.HeaderText = "Số kỳ KH"
        Me.SokykhDataGridViewTextBoxColumn.Name = "SokykhDataGridViewTextBoxColumn"
        '
        'NgaysdDataGridViewTextBoxColumn
        '
        Me.NgaysdDataGridViewTextBoxColumn.DataPropertyName = "ngaysd"
        Me.NgaysdDataGridViewTextBoxColumn.HeaderText = "Ngày SD"
        Me.NgaysdDataGridViewTextBoxColumn.Name = "NgaysdDataGridViewTextBoxColumn"
        '
        'thang_dau_kh
        '
        Me.thang_dau_kh.DataPropertyName = "thang_dau_kh"
        Me.thang_dau_kh.HeaderText = "Kỳ đầu  KH"
        Me.thang_dau_kh.Name = "thang_dau_kh"
        '
        'taikhoan_ts
        '
        Me.taikhoan_ts.DataPropertyName = "taikhoan_ts"
        Me.taikhoan_ts.HeaderText = "TK TS"
        Me.taikhoan_ts.Name = "taikhoan_ts"
        '
        'taikhoan_kh
        '
        Me.taikhoan_kh.DataPropertyName = "taikhoan_kh"
        Me.taikhoan_kh.HeaderText = "TK KH"
        Me.taikhoan_kh.Name = "taikhoan_kh"
        '
        'taikhoan_cp
        '
        Me.taikhoan_cp.DataPropertyName = "taikhoan_cp"
        Me.taikhoan_cp.HeaderText = "TK chi phí"
        Me.taikhoan_cp.Name = "taikhoan_cp"
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(542, 38)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(57, 16)
        Me.Label5.TabIndex = 42
        Me.Label5.Text = "Mã nhóm"
        Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'txttennhom
        '
        Me.txttennhom.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txttennhom.Location = New System.Drawing.Point(716, 36)
        Me.txttennhom.MaxLength = 50
        Me.txttennhom.Name = "txttennhom"
        Me.txttennhom.Size = New System.Drawing.Size(282, 22)
        Me.txttennhom.TabIndex = 43
        '
        'btn_cbo_nhom_taisan
        '
        Me.btn_cbo_nhom_taisan.Location = New System.Drawing.Point(690, 35)
        Me.btn_cbo_nhom_taisan.Name = "btn_cbo_nhom_taisan"
        Me.btn_cbo_nhom_taisan.Size = New System.Drawing.Size(24, 21)
        Me.btn_cbo_nhom_taisan.TabIndex = 1131
        Me.btn_cbo_nhom_taisan.Text = "...."
        Me.btn_cbo_nhom_taisan.UseVisualStyleBackColor = True
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(542, 66)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(57, 16)
        Me.Label6.TabIndex = 1132
        Me.Label6.Text = "Nước SX"
        Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'btn_cbo_mapb
        '
        Me.btn_cbo_mapb.Location = New System.Drawing.Point(164, 63)
        Me.btn_cbo_mapb.Name = "btn_cbo_mapb"
        Me.btn_cbo_mapb.Size = New System.Drawing.Size(24, 21)
        Me.btn_cbo_mapb.TabIndex = 1135
        Me.btn_cbo_mapb.Text = "...."
        Me.btn_cbo_mapb.UseVisualStyleBackColor = True
        '
        'txttenpb
        '
        Me.txttenpb.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txttenpb.Location = New System.Drawing.Point(190, 63)
        Me.txttenpb.MaxLength = 50
        Me.txttenpb.Name = "txttenpb"
        Me.txttenpb.Size = New System.Drawing.Size(351, 22)
        Me.txttenpb.TabIndex = 1134
        '
        'txtnguyengia
        '
        Me.txtnguyengia.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtnguyengia.Location = New System.Drawing.Point(237, 89)
        Me.txtnguyengia.MaxLength = 50
        Me.txtnguyengia.Name = "txtnguyengia"
        Me.txtnguyengia.Size = New System.Drawing.Size(125, 22)
        Me.txtnguyengia.TabIndex = 1136
        Me.txtnguyengia.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(169, 91)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(61, 19)
        Me.Label7.TabIndex = 1137
        Me.Label7.Text = "Nguyên giá"
        Me.Label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'Label8
        '
        Me.Label8.Location = New System.Drawing.Point(623, 91)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(68, 19)
        Me.Label8.TabIndex = 1139
        Me.Label8.Text = "Tỷ lệ KH (%)"
        Me.Label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'txttylekh
        '
        Me.txttylekh.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txttylekh.Location = New System.Drawing.Point(692, 89)
        Me.txttylekh.MaxLength = 50
        Me.txttylekh.Name = "txttylekh"
        Me.txttylekh.Size = New System.Drawing.Size(51, 22)
        Me.txttylekh.TabIndex = 1138
        Me.txttylekh.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label9
        '
        Me.Label9.Location = New System.Drawing.Point(472, 91)
        Me.Label9.Name = "Label9"
        Me.Label9.Size = New System.Drawing.Size(50, 19)
        Me.Label9.TabIndex = 1141
        Me.Label9.Text = "Mức KH"
        Me.Label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'txtmuckh
        '
        Me.txtmuckh.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtmuckh.Location = New System.Drawing.Point(525, 89)
        Me.txtmuckh.MaxLength = 50
        Me.txtmuckh.Name = "txtmuckh"
        Me.txtmuckh.Size = New System.Drawing.Size(99, 22)
        Me.txtmuckh.TabIndex = 1140
        Me.txtmuckh.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label10
        '
        Me.Label10.Location = New System.Drawing.Point(364, 91)
        Me.Label10.Name = "Label10"
        Me.Label10.Size = New System.Drawing.Size(55, 19)
        Me.Label10.TabIndex = 1143
        Me.Label10.Text = "Số kỳ KH"
        Me.Label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'txtsokykh
        '
        Me.txtsokykh.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtsokykh.Location = New System.Drawing.Point(424, 89)
        Me.txtsokykh.MaxLength = 50
        Me.txtsokykh.Name = "txtsokykh"
        Me.txtsokykh.Size = New System.Drawing.Size(47, 22)
        Me.txtsokykh.TabIndex = 1142
        Me.txtsokykh.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label11
        '
        Me.Label11.Location = New System.Drawing.Point(742, 91)
        Me.Label11.Name = "Label11"
        Me.Label11.Size = New System.Drawing.Size(50, 19)
        Me.Label11.TabIndex = 1145
        Me.Label11.Text = "Ngày SD"
        Me.Label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'Label12
        '
        Me.Label12.Location = New System.Drawing.Point(870, 91)
        Me.Label12.Name = "Label12"
        Me.Label12.Size = New System.Drawing.Size(64, 19)
        Me.Label12.TabIndex = 1147
        Me.Label12.Text = "Kỳ đầu KH"
        Me.Label12.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'txtthang_dau_kh
        '
        Me.txtthang_dau_kh.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtthang_dau_kh.Location = New System.Drawing.Point(936, 89)
        Me.txtthang_dau_kh.MaxLength = 6
        Me.txtthang_dau_kh.Name = "txtthang_dau_kh"
        Me.txtthang_dau_kh.Size = New System.Drawing.Size(62, 22)
        Me.txtthang_dau_kh.TabIndex = 1146
        Me.txtthang_dau_kh.Text = "201204"
        Me.txtthang_dau_kh.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'Label13
        '
        Me.Label13.Location = New System.Drawing.Point(5, 116)
        Me.Label13.Name = "Label13"
        Me.Label13.Size = New System.Drawing.Size(76, 19)
        Me.Label13.TabIndex = 1149
        Me.Label13.Text = "Tài khoản TS"
        Me.Label13.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'btn_cbo_taikhoan
        '
        Me.btn_cbo_taikhoan.Location = New System.Drawing.Point(167, 115)
        Me.btn_cbo_taikhoan.Name = "btn_cbo_taikhoan"
        Me.btn_cbo_taikhoan.Size = New System.Drawing.Size(24, 21)
        Me.btn_cbo_taikhoan.TabIndex = 1151
        Me.btn_cbo_taikhoan.Text = "...."
        Me.btn_cbo_taikhoan.UseVisualStyleBackColor = True
        '
        'Cbotaikhoan_ts
        '
        Me.Cbotaikhoan_ts.ArrowBoxColor = System.Drawing.SystemColors.Control
        Me.Cbotaikhoan_ts.ArrowColor = System.Drawing.Color.Black
        Me.Cbotaikhoan_ts.BindedControl = Nothing
        Me.Cbotaikhoan_ts.BorderStyle = MTGCComboBox.TipiBordi.Fixed3D
        Me.Cbotaikhoan_ts.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal
        Me.Cbotaikhoan_ts.ColumnNum = 1
        Me.Cbotaikhoan_ts.ColumnWidth = "121"
        Me.Cbotaikhoan_ts.DisabledArrowBoxColor = System.Drawing.SystemColors.Control
        Me.Cbotaikhoan_ts.DisabledArrowColor = System.Drawing.Color.LightGray
        Me.Cbotaikhoan_ts.DisabledBackColor = System.Drawing.SystemColors.Control
        Me.Cbotaikhoan_ts.DisabledBorderColor = System.Drawing.SystemColors.InactiveBorder
        Me.Cbotaikhoan_ts.DisabledForeColor = System.Drawing.SystemColors.GrayText
        Me.Cbotaikhoan_ts.DisplayMember = "Text"
        Me.Cbotaikhoan_ts.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.Cbotaikhoan_ts.DropDownBackColor = System.Drawing.Color.FromArgb(CType(CType(193, Byte), Integer), CType(CType(210, Byte), Integer), CType(CType(238, Byte), Integer))
        Me.Cbotaikhoan_ts.DropDownForeColor = System.Drawing.Color.Black
        Me.Cbotaikhoan_ts.DropDownStyle = MTGCComboBox.CustomDropDownStyle.DropDown
        Me.Cbotaikhoan_ts.DropDownWidth = 141
        Me.Cbotaikhoan_ts.GridLineColor = System.Drawing.Color.LightGray
        Me.Cbotaikhoan_ts.GridLineHorizontal = False
        Me.Cbotaikhoan_ts.GridLineVertical = False
        Me.Cbotaikhoan_ts.LoadingType = MTGCComboBox.CaricamentoCombo.ComboBoxItem
        Me.Cbotaikhoan_ts.Location = New System.Drawing.Point(77, 116)
        Me.Cbotaikhoan_ts.ManagingFastMouseMoving = True
        Me.Cbotaikhoan_ts.ManagingFastMouseMovingInterval = 30
        Me.Cbotaikhoan_ts.Name = "Cbotaikhoan_ts"
        Me.Cbotaikhoan_ts.SelectedItem = Nothing
        Me.Cbotaikhoan_ts.SelectedValue = Nothing
        Me.Cbotaikhoan_ts.Size = New System.Drawing.Size(85, 21)
        Me.Cbotaikhoan_ts.TabIndex = 1150
        '
        'Cbotaikhoan_kh
        '
        Me.Cbotaikhoan_kh.ArrowBoxColor = System.Drawing.SystemColors.Control
        Me.Cbotaikhoan_kh.ArrowColor = System.Drawing.Color.Black
        Me.Cbotaikhoan_kh.BindedControl = Nothing
        Me.Cbotaikhoan_kh.BorderStyle = MTGCComboBox.TipiBordi.Fixed3D
        Me.Cbotaikhoan_kh.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal
        Me.Cbotaikhoan_kh.ColumnNum = 1
        Me.Cbotaikhoan_kh.ColumnWidth = "121"
        Me.Cbotaikhoan_kh.DisabledArrowBoxColor = System.Drawing.SystemColors.Control
        Me.Cbotaikhoan_kh.DisabledArrowColor = System.Drawing.Color.LightGray
        Me.Cbotaikhoan_kh.DisabledBackColor = System.Drawing.SystemColors.Control
        Me.Cbotaikhoan_kh.DisabledBorderColor = System.Drawing.SystemColors.InactiveBorder
        Me.Cbotaikhoan_kh.DisabledForeColor = System.Drawing.SystemColors.GrayText
        Me.Cbotaikhoan_kh.DisplayMember = "Text"
        Me.Cbotaikhoan_kh.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.Cbotaikhoan_kh.DropDownBackColor = System.Drawing.Color.FromArgb(CType(CType(193, Byte), Integer), CType(CType(210, Byte), Integer), CType(CType(238, Byte), Integer))
        Me.Cbotaikhoan_kh.DropDownForeColor = System.Drawing.Color.Black
        Me.Cbotaikhoan_kh.DropDownStyle = MTGCComboBox.CustomDropDownStyle.DropDown
        Me.Cbotaikhoan_kh.DropDownWidth = 141
        Me.Cbotaikhoan_kh.GridLineColor = System.Drawing.Color.LightGray
        Me.Cbotaikhoan_kh.GridLineHorizontal = False
        Me.Cbotaikhoan_kh.GridLineVertical = False
        Me.Cbotaikhoan_kh.LoadingType = MTGCComboBox.CaricamentoCombo.ComboBoxItem
        Me.Cbotaikhoan_kh.Location = New System.Drawing.Point(285, 116)
        Me.Cbotaikhoan_kh.ManagingFastMouseMoving = True
        Me.Cbotaikhoan_kh.ManagingFastMouseMovingInterval = 30
        Me.Cbotaikhoan_kh.Name = "Cbotaikhoan_kh"
        Me.Cbotaikhoan_kh.SelectedItem = Nothing
        Me.Cbotaikhoan_kh.SelectedValue = Nothing
        Me.Cbotaikhoan_kh.Size = New System.Drawing.Size(85, 21)
        Me.Cbotaikhoan_kh.TabIndex = 1153
        '
        'Label14
        '
        Me.Label14.Location = New System.Drawing.Point(201, 116)
        Me.Label14.Name = "Label14"
        Me.Label14.Size = New System.Drawing.Size(76, 19)
        Me.Label14.TabIndex = 1152
        Me.Label14.Text = "Tài khoản KH"
        Me.Label14.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'Cbotaikhoan_cp
        '
        Me.Cbotaikhoan_cp.ArrowBoxColor = System.Drawing.SystemColors.Control
        Me.Cbotaikhoan_cp.ArrowColor = System.Drawing.Color.Black
        Me.Cbotaikhoan_cp.BindedControl = Nothing
        Me.Cbotaikhoan_cp.BorderStyle = MTGCComboBox.TipiBordi.Fixed3D
        Me.Cbotaikhoan_cp.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal
        Me.Cbotaikhoan_cp.ColumnNum = 1
        Me.Cbotaikhoan_cp.ColumnWidth = "121"
        Me.Cbotaikhoan_cp.DisabledArrowBoxColor = System.Drawing.SystemColors.Control
        Me.Cbotaikhoan_cp.DisabledArrowColor = System.Drawing.Color.LightGray
        Me.Cbotaikhoan_cp.DisabledBackColor = System.Drawing.SystemColors.Control
        Me.Cbotaikhoan_cp.DisabledBorderColor = System.Drawing.SystemColors.InactiveBorder
        Me.Cbotaikhoan_cp.DisabledForeColor = System.Drawing.SystemColors.GrayText
        Me.Cbotaikhoan_cp.DisplayMember = "Text"
        Me.Cbotaikhoan_cp.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.Cbotaikhoan_cp.DropDownBackColor = System.Drawing.Color.FromArgb(CType(CType(193, Byte), Integer), CType(CType(210, Byte), Integer), CType(CType(238, Byte), Integer))
        Me.Cbotaikhoan_cp.DropDownForeColor = System.Drawing.Color.Black
        Me.Cbotaikhoan_cp.DropDownStyle = MTGCComboBox.CustomDropDownStyle.DropDown
        Me.Cbotaikhoan_cp.DropDownWidth = 141
        Me.Cbotaikhoan_cp.GridLineColor = System.Drawing.Color.LightGray
        Me.Cbotaikhoan_cp.GridLineHorizontal = False
        Me.Cbotaikhoan_cp.GridLineVertical = False
        Me.Cbotaikhoan_cp.LoadingType = MTGCComboBox.CaricamentoCombo.ComboBoxItem
        Me.Cbotaikhoan_cp.Location = New System.Drawing.Point(456, 116)
        Me.Cbotaikhoan_cp.ManagingFastMouseMoving = True
        Me.Cbotaikhoan_cp.ManagingFastMouseMovingInterval = 30
        Me.Cbotaikhoan_cp.Name = "Cbotaikhoan_cp"
        Me.Cbotaikhoan_cp.SelectedItem = Nothing
        Me.Cbotaikhoan_cp.SelectedValue = Nothing
        Me.Cbotaikhoan_cp.Size = New System.Drawing.Size(85, 21)
        Me.Cbotaikhoan_cp.TabIndex = 1155
        '
        'Label15
        '
        Me.Label15.Location = New System.Drawing.Point(372, 116)
        Me.Label15.Name = "Label15"
        Me.Label15.Size = New System.Drawing.Size(76, 19)
        Me.Label15.TabIndex = 1154
        Me.Label15.Text = "Tài khoản CP"
        Me.Label15.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'Label16
        '
        Me.Label16.Location = New System.Drawing.Point(544, 116)
        Me.Label16.Name = "Label16"
        Me.Label16.Size = New System.Drawing.Size(57, 16)
        Me.Label16.TabIndex = 1157
        Me.Label16.Text = "Ghi chú"
        Me.Label16.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'txtghichu
        '
        Me.txtghichu.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtghichu.Location = New System.Drawing.Point(603, 116)
        Me.txtghichu.MaxLength = 100
        Me.txtghichu.Name = "txtghichu"
        Me.txtghichu.Size = New System.Drawing.Size(395, 22)
        Me.txtghichu.TabIndex = 1156
        '
        'cbomanhom
        '
        Me.cbomanhom.ArrowBoxColor = System.Drawing.SystemColors.Control
        Me.cbomanhom.ArrowColor = System.Drawing.Color.Black
        Me.cbomanhom.BindedControl = Nothing
        Me.cbomanhom.BorderStyle = MTGCComboBox.TipiBordi.Fixed3D
        Me.cbomanhom.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal
        Me.cbomanhom.ColumnNum = 1
        Me.cbomanhom.ColumnWidth = "121"
        Me.cbomanhom.DisabledArrowBoxColor = System.Drawing.SystemColors.Control
        Me.cbomanhom.DisabledArrowColor = System.Drawing.Color.LightGray
        Me.cbomanhom.DisabledBackColor = System.Drawing.SystemColors.Control
        Me.cbomanhom.DisabledBorderColor = System.Drawing.SystemColors.InactiveBorder
        Me.cbomanhom.DisabledForeColor = System.Drawing.SystemColors.GrayText
        Me.cbomanhom.DisplayMember = "Text"
        Me.cbomanhom.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cbomanhom.DropDownBackColor = System.Drawing.Color.FromArgb(CType(CType(193, Byte), Integer), CType(CType(210, Byte), Integer), CType(CType(238, Byte), Integer))
        Me.cbomanhom.DropDownForeColor = System.Drawing.Color.Black
        Me.cbomanhom.DropDownStyle = MTGCComboBox.CustomDropDownStyle.DropDown
        Me.cbomanhom.DropDownWidth = 141
        Me.cbomanhom.GridLineColor = System.Drawing.Color.LightGray
        Me.cbomanhom.GridLineHorizontal = False
        Me.cbomanhom.GridLineVertical = False
        Me.cbomanhom.LoadingType = MTGCComboBox.CaricamentoCombo.ComboBoxItem
        Me.cbomanhom.Location = New System.Drawing.Point(603, 36)
        Me.cbomanhom.ManagingFastMouseMoving = True
        Me.cbomanhom.ManagingFastMouseMovingInterval = 30
        Me.cbomanhom.Name = "cbomanhom"
        Me.cbomanhom.SelectedItem = Nothing
        Me.cbomanhom.SelectedValue = Nothing
        Me.cbomanhom.Size = New System.Drawing.Size(85, 21)
        Me.cbomanhom.TabIndex = 1158
        '
        'cbomapb
        '
        Me.cbomapb.ArrowBoxColor = System.Drawing.SystemColors.Control
        Me.cbomapb.ArrowColor = System.Drawing.Color.Black
        Me.cbomapb.BindedControl = Nothing
        Me.cbomapb.BorderStyle = MTGCComboBox.TipiBordi.Fixed3D
        Me.cbomapb.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal
        Me.cbomapb.ColumnNum = 1
        Me.cbomapb.ColumnWidth = "121"
        Me.cbomapb.DisabledArrowBoxColor = System.Drawing.SystemColors.Control
        Me.cbomapb.DisabledArrowColor = System.Drawing.Color.LightGray
        Me.cbomapb.DisabledBackColor = System.Drawing.SystemColors.Control
        Me.cbomapb.DisabledBorderColor = System.Drawing.SystemColors.InactiveBorder
        Me.cbomapb.DisabledForeColor = System.Drawing.SystemColors.GrayText
        Me.cbomapb.DisplayMember = "Text"
        Me.cbomapb.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
        Me.cbomapb.DropDownBackColor = System.Drawing.Color.FromArgb(CType(CType(193, Byte), Integer), CType(CType(210, Byte), Integer), CType(CType(238, Byte), Integer))
        Me.cbomapb.DropDownForeColor = System.Drawing.Color.Black
        Me.cbomapb.DropDownStyle = MTGCComboBox.CustomDropDownStyle.DropDown
        Me.cbomapb.DropDownWidth = 141
        Me.cbomapb.GridLineColor = System.Drawing.Color.LightGray
        Me.cbomapb.GridLineHorizontal = False
        Me.cbomapb.GridLineVertical = False
        Me.cbomapb.LoadingType = MTGCComboBox.CaricamentoCombo.ComboBoxItem
        Me.cbomapb.Location = New System.Drawing.Point(77, 63)
        Me.cbomapb.ManagingFastMouseMoving = True
        Me.cbomapb.ManagingFastMouseMovingInterval = 30
        Me.cbomapb.Name = "cbomapb"
        Me.cbomapb.SelectedItem = Nothing
        Me.cbomapb.SelectedValue = Nothing
        Me.cbomapb.Size = New System.Drawing.Size(85, 21)
        Me.cbomapb.TabIndex = 1159
        '
        'txtngaysd
        '
        Me.txtngaysd.Location = New System.Drawing.Point(790, 89)
        Me.txtngaysd.Mask = "00/00/0000"
        Me.txtngaysd.Name = "txtngaysd"
        Me.txtngaysd.Size = New System.Drawing.Size(80, 20)
        Me.txtngaysd.TabIndex = 1160
        Me.txtngaysd.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'TStaisanBindingSource
        '
        Me.TStaisanBindingSource.DataMember = "TS_taisan"
        Me.TStaisanBindingSource.DataSource = Me.DataSetForm_Don
        '
        'DataSetForm_Don
        '
        Me.DataSetForm_Don.DataSetName = "DataSetForm_Don"
        Me.DataSetForm_Don.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
        '
        'DataSetFormDonBindingSource
        '
        Me.DataSetFormDonBindingSource.DataSource = Me.DataSetForm_Don
        Me.DataSetFormDonBindingSource.Position = 0
        '
        'DataGridView1
        '
        Me.DataGridView1.AllowUserToAddRows = False
        Me.DataGridView1.AllowUserToDeleteRows = False
        Me.DataGridView1.AllowUserToResizeColumns = False
        Me.DataGridView1.AutoGenerateColumns = False
        Me.DataGridView1.BackgroundColor = System.Drawing.Color.LightBlue
        DataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter
        DataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control
        DataGridViewCellStyle1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        DataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText
        DataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight
        DataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText
        DataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
        Me.DataGridView1.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle1
        Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
        Me.DataGridView1.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.colma, Me.colten, Me.coldvt, Me.colmapb, Me.coltenpb, Me.colnuocsx, Me.colnguyengia, Me.coltylekh, Me.colmuckh, Me.colsokykh, Me.colngaysd, Me.colthang_dau_kh, Me.coltaikhoan_ts, Me.coltaikhoan_kh, Me.coltaikhoan_cp, Me.colmanhom, Me.coltennhom, Me.colghichu})
        Me.DataGridView1.DataSource = Me.TStaisanBindingSource
        Me.DataGridView1.Location = New System.Drawing.Point(1, 185)
        Me.DataGridView1.Name = "DataGridView1"
        Me.DataGridView1.ReadOnly = True
        Me.DataGridView1.RowHeadersWidth = 25
        Me.DataGridView1.Size = New System.Drawing.Size(1004, 386)
        Me.DataGridView1.TabIndex = 40
        '
        'colma
        '
        Me.colma.DataPropertyName = "ma"
        Me.colma.HeaderText = "Mã"
        Me.colma.Name = "colma"
        Me.colma.ReadOnly = True
        Me.colma.Width = 50
        '
        'colten
        '
        Me.colten.DataPropertyName = "ten"
        Me.colten.HeaderText = "Tên"
        Me.colten.Name = "colten"
        Me.colten.ReadOnly = True
        Me.colten.Width = 160
        '
        'coldvt
        '
        Me.coldvt.DataPropertyName = "dvt"
        Me.coldvt.HeaderText = "ĐVT"
        Me.coldvt.Name = "coldvt"
        Me.coldvt.ReadOnly = True
        Me.coldvt.Width = 37
        '
        'colmapb
        '
        Me.colmapb.DataPropertyName = "mapb"
        Me.colmapb.HeaderText = "Mã BP"
        Me.colmapb.Name = "colmapb"
        Me.colmapb.ReadOnly = True
        Me.colmapb.Width = 55
        '
        'coltenpb
        '
        Me.coltenpb.DataPropertyName = "tenpb"
        Me.coltenpb.HeaderText = "Tên BP"
        Me.coltenpb.Name = "coltenpb"
        Me.coltenpb.ReadOnly = True
        '
        'colnuocsx
        '
        Me.colnuocsx.DataPropertyName = "nuocsx"
        Me.colnuocsx.HeaderText = "Nước sx"
        Me.colnuocsx.Name = "colnuocsx"
        Me.colnuocsx.ReadOnly = True
        Me.colnuocsx.Width = 80
        '
        'colnguyengia
        '
        Me.colnguyengia.DataPropertyName = "nguyengia"
        DataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight
        DataGridViewCellStyle2.Format = "N0"
        Me.colnguyengia.DefaultCellStyle = DataGridViewCellStyle2
        Me.colnguyengia.HeaderText = "Nguyên giá"
        Me.colnguyengia.Name = "colnguyengia"
        Me.colnguyengia.ReadOnly = True
        '
        'coltylekh
        '
        Me.coltylekh.DataPropertyName = "tylekh"
        DataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight
        DataGridViewCellStyle3.Format = "N2"
        Me.coltylekh.DefaultCellStyle = DataGridViewCellStyle3
        Me.coltylekh.HeaderText = "Tỷ lệ KH"
        Me.coltylekh.Name = "coltylekh"
        Me.coltylekh.ReadOnly = True
        Me.coltylekh.Width = 55
        '
        'colmuckh
        '
        Me.colmuckh.DataPropertyName = "muckh"
        DataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight
        DataGridViewCellStyle4.Format = "N0"
        Me.colmuckh.DefaultCellStyle = DataGridViewCellStyle4
        Me.colmuckh.HeaderText = "Mức KH"
        Me.colmuckh.Name = "colmuckh"
        Me.colmuckh.ReadOnly = True
        Me.colmuckh.Width = 70
        '
        'colsokykh
        '
        Me.colsokykh.DataPropertyName = "sokykh"
        DataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight
        DataGridViewCellStyle5.Format = "N0"
        Me.colsokykh.DefaultCellStyle = DataGridViewCellStyle5
        Me.colsokykh.HeaderText = "Số kỳ KH"
        Me.colsokykh.Name = "colsokykh"
        Me.colsokykh.ReadOnly = True
        Me.colsokykh.Width = 55
        '
        'colngaysd
        '
        Me.colngaysd.DataPropertyName = "ngaysd"
        Me.colngaysd.HeaderText = "Ngày SD"
        Me.colngaysd.Name = "colngaysd"
        Me.colngaysd.ReadOnly = True
        Me.colngaysd.Width = 65
        '
        'colthang_dau_kh
        '
        Me.colthang_dau_kh.DataPropertyName = "thang_dau_kh"
        Me.colthang_dau_kh.HeaderText = "Kỳ đầu KH"
        Me.colthang_dau_kh.Name = "colthang_dau_kh"
        Me.colthang_dau_kh.ReadOnly = True
        Me.colthang_dau_kh.Width = 55
        '
        'coltaikhoan_ts
        '
        Me.coltaikhoan_ts.DataPropertyName = "taikhoan_ts"
        Me.coltaikhoan_ts.HeaderText = "TK TS"
        Me.coltaikhoan_ts.Name = "coltaikhoan_ts"
        Me.coltaikhoan_ts.ReadOnly = True
        Me.coltaikhoan_ts.Width = 50
        '
        'coltaikhoan_kh
        '
        Me.coltaikhoan_kh.DataPropertyName = "taikhoan_kh"
        Me.coltaikhoan_kh.HeaderText = "TK KH"
        Me.coltaikhoan_kh.Name = "coltaikhoan_kh"
        Me.coltaikhoan_kh.ReadOnly = True
        Me.coltaikhoan_kh.Width = 50
        '
        'coltaikhoan_cp
        '
        Me.coltaikhoan_cp.DataPropertyName = "taikhoan_cp"
        Me.coltaikhoan_cp.HeaderText = "TK CP"
        Me.coltaikhoan_cp.Name = "coltaikhoan_cp"
        Me.coltaikhoan_cp.ReadOnly = True
        Me.coltaikhoan_cp.Width = 50
        '
        'colmanhom
        '
        Me.colmanhom.DataPropertyName = "manhom"
        Me.colmanhom.HeaderText = "Mã nhóm"
        Me.colmanhom.Name = "colmanhom"
        Me.colmanhom.ReadOnly = True
        Me.colmanhom.Width = 55
        '
        'coltennhom
        '
        Me.coltennhom.DataPropertyName = "tennhom"
        Me.coltennhom.HeaderText = "Tên nhóm "
        Me.coltennhom.Name = "coltennhom"
        Me.coltennhom.ReadOnly = True
        '
        'colghichu
        '
        Me.colghichu.DataPropertyName = "ghichu"
        Me.colghichu.HeaderText = "Ghi chú"
        Me.colghichu.Name = "colghichu"
        Me.colghichu.ReadOnly = True
        '
        'txtDVT
        '
        Me.txtDVT.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtDVT.Location = New System.Drawing.Point(77, 89)
        Me.txtDVT.MaxLength = 10
        Me.txtDVT.Name = "txtDVT"
        Me.txtDVT.Size = New System.Drawing.Size(85, 22)
        Me.txtDVT.TabIndex = 1161
        Me.txtDVT.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
        '
        'Label17
        '
        Me.Label17.Location = New System.Drawing.Point(9, 91)
        Me.Label17.Name = "Label17"
        Me.Label17.Size = New System.Drawing.Size(63, 19)
        Me.Label17.TabIndex = 1162
        Me.Label17.Text = "Đơn vị tính"
        Me.Label17.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'Btn_Lamtuoi
        '
        Me.Btn_Lamtuoi.Image = CType(resources.GetObject("Btn_Lamtuoi.Image"), System.Drawing.Image)
        Me.Btn_Lamtuoi.Location = New System.Drawing.Point(598, 150)
        Me.Btn_Lamtuoi.Name = "Btn_Lamtuoi"
        Me.Btn_Lamtuoi.Size = New System.Drawing.Size(85, 24)
        Me.Btn_Lamtuoi.TabIndex = 1164
        '
        'Btn_Edit
        '
        Me.Btn_Edit.BackColor = System.Drawing.Color.Transparent
        Me.Btn_Edit.Image = CType(resources.GetObject("Btn_Edit.Image"), System.Drawing.Image)
        Me.Btn_Edit.Location = New System.Drawing.Point(331, 150)
        Me.Btn_Edit.Name = "Btn_Edit"
        Me.Btn_Edit.Size = New System.Drawing.Size(85, 24)
        Me.Btn_Edit.TabIndex = 1163
        Me.Btn_Edit.UseVisualStyleBackColor = False
        '
        'frmTS_Taisan
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackColor = System.Drawing.Color.LightBlue
        Me.ClientSize = New System.Drawing.Size(1004, 573)
        Me.Controls.Add(Me.Btn_Lamtuoi)
        Me.Controls.Add(Me.Btn_Edit)
        Me.Controls.Add(Me.txtDVT)
        Me.Controls.Add(Me.Label17)
        Me.Controls.Add(Me.DataGridView1)
        Me.Controls.Add(Me.txtngaysd)
        Me.Controls.Add(Me.cbomapb)
        Me.Controls.Add(Me.cbomanhom)
        Me.Controls.Add(Me.Label16)
        Me.Controls.Add(Me.txtghichu)
        Me.Controls.Add(Me.Cbotaikhoan_cp)
        Me.Controls.Add(Me.Label15)
        Me.Controls.Add(Me.Cbotaikhoan_kh)
        Me.Controls.Add(Me.Label14)
        Me.Controls.Add(Me.btn_cbo_taikhoan)
        Me.Controls.Add(Me.Cbotaikhoan_ts)
        Me.Controls.Add(Me.Label13)
        Me.Controls.Add(Me.Label12)
        Me.Controls.Add(Me.txtthang_dau_kh)
        Me.Controls.Add(Me.Label11)
        Me.Controls.Add(Me.Label10)
        Me.Controls.Add(Me.txtsokykh)
        Me.Controls.Add(Me.Label9)
        Me.Controls.Add(Me.txtmuckh)
        Me.Controls.Add(Me.Label8)
        Me.Controls.Add(Me.txttylekh)
        Me.Controls.Add(Me.Label7)
        Me.Controls.Add(Me.txtnguyengia)
        Me.Controls.Add(Me.btn_cbo_mapb)
        Me.Controls.Add(Me.txttenpb)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.btn_cbo_nhom_taisan)
        Me.Controls.Add(Me.txttennhom)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.BtnIn)
        Me.Controls.Add(Me.BtnClose)
        Me.Controls.Add(Me.txtnuocsx)
        Me.Controls.Add(Me.txtten)
        Me.Controls.Add(Me.txtma)
        Me.Controls.Add(Me.btnDelete1)
        Me.Controls.Add(Me.btnNew)
        Me.Controls.Add(Me.btnSave)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Name = "frmTS_Taisan"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Danh Muc Tai San"
        CType(Me.TStaisanBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.DataSetForm_Don, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.DataSetFormDonBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region
    Dim co_tuoi As Integer = 0
    Private data1, datamanhom, dataPhongban As DataTable
    Private da As MySqlDataAdapter
    Dim co_phim_tat As Boolean = False
    Dim myDT As New DataTable
    Dim strError As String = ""
    Dim myform As Form
    Dim sqlQuery As String = ""

    Sub SetclearData()
        Me.txtngaysd.Text = Today
        Me.txtthang_dau_kh.Text = Format(Today.Year, "0000") & Format(Today.Month, "00")
        Me.txtma.Text = ""
        Me.txtten.Text = ""
        Me.txtnuocsx.Text = "Việt nam "
        Me.txtDVT.Text = "Cái"
        Me.txtnguyengia.Text = "0"
        Me.txttylekh.Text = "0"
        Me.txtmuckh.Text = "0"
        Me.txtsokykh.Text = "0"

    End Sub
    Private Sub txtma_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtma.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.txtten.Focus()
        End If
    End Sub
    Private Sub txtten_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtten.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.cbomanhom.Focus()
        End If
    End Sub
    Private Sub cbomanhom_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles cbomanhom.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.txttennhom.Focus()
        End If
    End Sub
    Private Sub txttennhom_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txttennhom.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.cbomapb.Focus()
        End If
    End Sub
    Private Sub cbomapb_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles cbomapb.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.txttenpb.Focus()
        End If
    End Sub
    Private Sub txttenpb_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txttenpb.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.txtnuocsx.Focus()
        End If
    End Sub
    Private Sub txtnuocsx_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtnuocsx.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.txtDVT.Focus()
        End If
    End Sub

    Private Sub txtDVT_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtDVT.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.txtnguyengia.Focus()
        End If
    End Sub
    Private Sub txtnguyengia_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtnguyengia.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.txtsokykh.Focus()
        End If
    End Sub
    Private Sub txtsokykh_KeyDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtsokykh.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.txtmuckh.Focus()
        End If
    End Sub
    Private Sub txtmuckh_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtmuckh.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.txttylekh.Focus()
        End If
    End Sub
    Private Sub txttylekh_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txttylekh.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.txtngaysd.Focus()
        End If
    End Sub

    Private Sub txtsokykh_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtngaysd.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.txtthang_dau_kh.Focus()
        End If
    End Sub
    Private Sub txtthang_dau_kh_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtthang_dau_kh.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.Cbotaikhoan_ts.Focus()
        End If
    End Sub
    Private Sub Cbotaikhoan_ts_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Cbotaikhoan_ts.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.Cbotaikhoan_kh.Focus()
        End If
    End Sub
    Private Sub Cbotaikhoan_kh_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Cbotaikhoan_kh.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.Cbotaikhoan_cp.Focus()
        End If
    End Sub

    Private Sub Cbotaikhoan_cp_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Cbotaikhoan_cp.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.txtghichu.Focus()
        End If
    End Sub
    Private Sub txtghichu_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtghichu.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.btnSave.Focus()
        End If
    End Sub

    Private Sub btnSave_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles btnSave.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.btnNew.Focus()
        End If
    End Sub
    Private Sub btnNew_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles btnNew.KeyDown
        If e.KeyCode = Keys.Enter Then
            Me.txtma.Focus()
        End If
    End Sub

    Private Sub frmTS_Phongban_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        'edit = moduleConstants.edit
        'If edit = 0 Then
        '    '  MessageBox.Show("Bạn chưa được cấp quyền !", globalVariale.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information)
        'Else
        If Me.co_phim_tat = True Then
            If e.KeyCode = (e.Control And Keys.S) Then
                luu()
                Me.setReadonly(True, False, False)
            End If
            If e.KeyCode = (e.Control And Keys.D) Then
                xoa()
                Me.setReadonly(True, False, False)
            End If
        End If
        If e.KeyCode = (e.Control And Keys.N) Then
            SetclearData()
            txtma.Focus()
            Me.setReadonly(False, True, True)
        End If
        If e.KeyCode = (e.Control And Keys.E) Then
            Me.setReadonly(False, True, True)
        End If
        If e.KeyCode = (e.Control And Keys.Q) Then
            Me.Close()
        End If
        If e.KeyCode = Keys.Escape Then
            Me.Close()
        End If
        If e.KeyCode = (e.Control And Keys.P) Then
            FrmCrTS_Taisan.Show()
        End If
        If e.KeyCode = (e.Control And Keys.R) Then
            If co_tuoi = 1 Then
                Me.loadNhomTS()
            End If
            If co_tuoi = 2 Then
                Me.loadPhongban()
            End If
            If co_tuoi = 3 Then
                Me.loadTaikhoan()
            End If
            If co_tuoi = 0 Then
                Me.loadDanhSachNhomHangHoa("SELECT * FROM TS_taisan")
            End If
        End If
        ' end if
    End Sub
    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        If Me.txtthang_dau_kh.Text.Length <> 6 Then
            MessageBox.Show("Bạn nhập đúng KỲ ĐẦU KH gồm 6 ký tự là Năm và Tháng, Ví dụ:201204 ", globalVariale.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information)
            Me.txtthang_dau_kh.Focus()
        Else
            If Me.txtthang_dau_kh.Text.Substring(0, 2) <> "20" Then
                MessageBox.Show("Bạn nhập đúng 4 ký tự Năm và 02 ký tự Tháng, Ví dụ:201204 ", globalVariale.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information)
                Me.txtthang_dau_kh.Focus()
            Else
                luu()
                Me.setReadonly(True, False, False)
            End If
        End If
    End Sub
   
    Private Sub luu()
        ' Kiểm tra có nhập liệu chưa ?
        If Me.checkInput(txtma.Text, txtten.Text) Then
            Dim txtMaTinh = Me.txtma.Text.Trim
            sqlQuery = "SELECT ma FROM TS_taisan WHERE ma = '" & txtMaTinh & "'"
            Dim existedMaTinh As Integer = moduleDatabaseConn.CheckRecordExisted(sqlQuery)
            If existedMaTinh = 1 Then ' Update record
                sqlQuery = "UPDATE TS_taisan "
                sqlQuery += "SET "
                sqlQuery += "ma = '" & Me.txtma.Text.Trim & "'"
                sqlQuery += ", ten = '" & Me.txtten.Text.Trim & "'"
                sqlQuery += ", manhom = '" & Me.cbomanhom.Text.Trim & "'"
                sqlQuery += ", tennhom = '" & Me.txttennhom.Text.Trim & "'"
                sqlQuery += ", mapb = '" & Me.cbomapb.Text.Trim & "'"
                sqlQuery += ", tenpb = '" & Me.txttenpb.Text.Trim & "'"
                sqlQuery += ", nuocsx = '" & Me.txtnuocsx.Text.Trim & "'"
                sqlQuery += ", dvt = '" & Me.txtDVT.Text.Trim & "'"
                sqlQuery += ", nguyengia = '" & Replace(CDec(Me.txtnguyengia.Text.Trim), ",", ".") & "'"
                sqlQuery += ", tylekh = '" & Replace(CDec(Me.txttylekh.Text.Trim), ",", ".") & "'"
                sqlQuery += ", muckh = '" & Replace(CDec(Me.txtmuckh.Text.Trim), ",", ".") & "'"
                sqlQuery += ", sokykh = '" & Me.txtsokykh.Text.Trim & "'"
                sqlQuery += ", ngaysd = '" & Format(CDate(Me.txtngaysd.Text.Trim), "yyyy-MM-dd") & "'"
                sqlQuery += ", thang_dau_kh = '" & Me.txtthang_dau_kh.Text.Trim & "'"
                sqlQuery += ", taikhoan_ts = '" & Me.Cbotaikhoan_ts.Text.Trim & "'"
                sqlQuery += ", taikhoan_kh = '" & Me.Cbotaikhoan_kh.Text.Trim & "'"
                sqlQuery += ", taikhoan_cp = '" & Me.Cbotaikhoan_cp.Text.Trim & "'"
                sqlQuery += ", ghichu = '" & Me.txtnuocsx.Text.Trim & "'"
                sqlQuery += " WHERE ma= '" & txtMaTinh & "'"
                Dim updated As Integer = moduleDatabaseConn.ExecuteNonQuery(sqlQuery)
                If updated = 1 Then
                    MessageBox.Show("Cập nhật thông tin thành công !")
                    sqlQuery = "SELECT * FROM TS_taisan"
                    Me.loadDanhSachNhomHangHoa(sqlQuery)
                Else
                    MessageBox.Show("Cập nhật thông tin không thành công: " & globalVariale.sqlMsgError)
                End If
            Else
                If existedMaTinh = 0 Then ' Insert record
                    sqlQuery = "INSERT INTO TS_taisan "
                    sqlQuery += "(ma,ten,mapb,tenpb,nuocsx,nguyengia,tylekh,muckh,sokykh,ngaysd,thang_dau_kh,taikhoan_ts,taikhoan_kh,taikhoan_cp,ghichu,manhom,tennhom,dvt) "
                    sqlQuery += "VALUES "
                    sqlQuery += "("
                    sqlQuery += "'" & Me.txtma.Text.Trim & "', "
                    sqlQuery += "'" & Me.txtten.Text.Trim & "', "
                    sqlQuery += "'" & Me.cbomapb.Text.Trim & "', "
                    sqlQuery += "'" & Me.txttenpb.Text.Trim & "', "
                    sqlQuery += "'" & Me.txtnuocsx.Text.Trim & "', "
                    sqlQuery += "'" & Replace(CDec(Me.txtnguyengia.Text.Trim), ",", ".") & "', "
                    sqlQuery += "'" & Replace(CDec(Me.txttylekh.Text.Trim), ",", ".") & "', "
                    sqlQuery += "'" & Replace(CDec(Me.txtmuckh.Text.Trim), ",", ".") & "', "
                    sqlQuery += "'" & Me.txtsokykh.Text.Trim & "', "
                    sqlQuery += "'" & Format(CDate(Me.txtngaysd.Text.Trim), "yyyy-MM-dd") & "', "
                    sqlQuery += "'" & Me.txtthang_dau_kh.Text.Trim & "', "
                    sqlQuery += "'" & Me.Cbotaikhoan_ts.Text.Trim & "', "
                    sqlQuery += "'" & Me.Cbotaikhoan_kh.Text.Trim & "', "
                    sqlQuery += "'" & Me.Cbotaikhoan_cp.Text.Trim & "', "
                    sqlQuery += "'" & Me.txtghichu.Text.Trim & "', "
                    sqlQuery += "'" & Me.cbomanhom.Text.Trim & "', "
                    sqlQuery += "'" & Me.txttennhom.Text.Trim & "',  "
                    sqlQuery += "'" & Me.txtDVT.Text.Trim & "'  "
                    sqlQuery += ")"
                    Dim inserted As Integer = moduleDatabaseConn.ExecuteNonQuery(sqlQuery)
                    If inserted = 1 Then
                        MessageBox.Show("Thêm thông tin thành công !")
                        sqlQuery = "SELECT * FROM TS_taisan"
                        Me.loadDanhSachNhomHangHoa(sqlQuery)
                    Else
                        MessageBox.Show("Thêm thông tin không thành công: " & globalVariale.sqlMsgError)
                    End If
                Else ' SQLExeption: existedMaQuocGia = -1
                    MessageBox.Show("Lấy dữ liệu bị lỗi: " & globalVariale.sqlMsgError, "Lấy dữ liệu", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                End If
            End If
        End If
    End Sub

    Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click
        SetclearData()
        txtma.Focus()
        Me.setReadonly(False, True, True)
    End Sub
    Private Sub btnDelete1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete1.Click
        xoa()
        Me.setReadonly(True, False, False)
    End Sub
    Private Sub xoa()
        Dim txtMaTinh As String = Trim(Me.txtma.Text)
        If txtMaTinh = "" Then
            MessageBox.Show("Bạn chưa chọn Mã để xóa !")
        Else
            Dim txtTenTinh As String = Trim(Me.txtten.Text)
            moduleConstants.MessageWarning = "Bạn có muốn xóa  " & txtMaTinh & "(" & txtTenTinh & ") ?"

            If MessageBox.Show(moduleConstants.MessageWarning, globalVariale.msgTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = MsgBoxResult.Yes Then
                Dim sqlQuery As String = "DELETE FROM TS_taisan WHERE ma = '" & txtMaTinh & "'"
                Dim deleting As Integer = moduleDatabaseConn.ExecuteNonQuery(sqlQuery)
                If deleting = 1 Then
                    MessageBox.Show("Xóa thông tin thành công !")
                    sqlQuery = "SELECT * FROM TS_taisan"
                    Me.loadDanhSachNhomHangHoa(sqlQuery)
                    SetclearData()
                Else
                    MessageBox.Show("Xóa thông tin không thành công: " & globalVariale.sqlMsgError)
                End If
            End If
        End If
    End Sub
    Private Sub setReadonly(ByVal bien_text As Boolean, ByVal bien_com As Boolean, ByVal v_co_phim_tat As Boolean)

        Me.txtma.ReadOnly = bien_text
        Me.txtten.ReadOnly = bien_text
        Me.txttennhom.ReadOnly = bien_text
        Me.txttenpb.ReadOnly = bien_text

        Me.txtnuocsx.ReadOnly = bien_text
        Me.txtDVT.ReadOnly = bien_text
        Me.txtnguyengia.ReadOnly = bien_text
        Me.txttylekh.ReadOnly = bien_text

        Me.txtmuckh.ReadOnly = bien_text
        Me.txtsokykh.ReadOnly = bien_text
        Me.txtngaysd.ReadOnly = bien_text
        Me.txtthang_dau_kh.ReadOnly = bien_text
        Me.txtghichu.ReadOnly = bien_text
      
        Me.cbomanhom.Enabled = bien_com
        Me.cbomapb.Enabled = bien_com
        Me.Cbotaikhoan_ts.Enabled = bien_com
        Me.Cbotaikhoan_kh.Enabled = bien_com
        Me.Cbotaikhoan_cp.Enabled = bien_com

        Me.btnDelete1.Enabled = bien_com
        Me.btnSave.Enabled = bien_com
        Me.co_phim_tat = v_co_phim_tat

        Me.btn_cbo_mapb.Enabled = bien_com
        Me.btn_cbo_nhom_taisan.Enabled = bien_com
        Me.btn_cbo_taikhoan.Enabled = bien_com
    End Sub
    Private Sub frmTS_Phongban_load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        moduleUtils.setDinhDangVietNam()
        Me.KeyPreview = True
        Me.setReadonly(True, False, False)
        Me.txtthang_dau_kh.Text = Format(Today.Year, "0000") & Format(Today.Month, "00")
        'roles
        'edit = moduleConstants.edit
        'If edit = 0 Then
        '    Me.btnNew.Enabled = False
        '    Me.btnSave.Enabled = False
        '    Me.btnDelete1.Enabled = False
        '    Me.BtnIn.Enabled = False
        '    Me.DataGridView1.ReadOnly = True

        'End If
        Me.loadPhongban()
        Me.loadNhomTS()
        Me.loadTaikhoan()
        Me.loadDanhSachNhomHangHoa("SELECT * FROM TS_taisan")

    End Sub

    Private Sub BtnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnClose.Click
        Me.Close()
    End Sub
    Private Sub BtnIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnIn.Click
        FrmCrTS_Taisan.Show()
    End Sub
    Function checkInput(ByVal ma As String, ByVal ten As String) As Boolean
        Dim result As Boolean = True
        If ma = "" Then
            MessageBox.Show("Bạn chưa chọn Mã  !")
            result = False
        Else
            If ten = "" Then
                MessageBox.Show("Bạn chưa nhập tên !")
                result = False
            End If
        End If
        Return result
    End Function
    Private Sub loadDanhSachNhomHangHoa(ByVal sqlQuery As String)
        Me.DataGridView1.DataSource = moduleDatabaseConn.GetDataTable(sqlQuery)
    End Sub
    Private Sub loadNhomTS()
        Try
            sqlQuery = "SELECT ma_nhom_hanghoa, ten_nhom_hanghoa FROM TS_nhomts ORDER BY ma_nhom_hanghoa "
            datamanhom = moduleDatabaseConn.GetDataTable(sqlQuery)
            cbomanhom.Items.Clear()
            cbomanhom.LoadingType = MTGCComboBox.CaricamentoCombo.DataTable
            cbomanhom.ColumnNum = 2
            cbomanhom.ColumnWidth = "150;300"
            cbomanhom.HighlightBorderColor = Color.Black
            cbomanhom.GridLineHorizontal = True
            cbomanhom.GridLineVertical = True
            cbomanhom.ItemHeight = 17
            cbomanhom.DropDownHeight = 300
            cbomanhom.SourceDataTable = datamanhom
            cbomanhom.SelectedIndex = 0
        Catch ex As Exception
        End Try
    End Sub
    Private Sub loadPhongban()
        Try
            sqlQuery = "SELECT ma_nhom_hanghoa, ten_nhom_hanghoa FROM TS_phongban ORDER BY ma_nhom_hanghoa "
            dataPhongban = moduleDatabaseConn.GetDataTable(sqlQuery)
            cbomapb.Items.Clear()
            cbomapb.LoadingType = MTGCComboBox.CaricamentoCombo.DataTable
            cbomapb.ColumnNum = 2
            cbomapb.ColumnWidth = "150;300"
            cbomapb.HighlightBorderColor = Color.Black
            cbomapb.GridLineHorizontal = True
            cbomapb.GridLineVertical = True
            cbomapb.ItemHeight = 17
            cbomapb.DropDownHeight = 300
            cbomapb.SourceDataTable = dataPhongban
            cbomapb.SelectedIndex = 0
        Catch ex As Exception
        End Try
    End Sub
    Private Sub loadTaikhoan()
        Try
            sqlQuery = "SELECT ma_tieukhoan,ten_tieukhoan FROM tbl_tieukhoan ORDER BY ma_tieukhoan "
            ' Load TK TS
            Cbotaikhoan_ts.Items.Clear()
            Cbotaikhoan_ts.LoadingType = MTGCComboBox.CaricamentoCombo.DataTable
            Cbotaikhoan_ts.ColumnNum = 2
            Cbotaikhoan_ts.ColumnWidth = "150;300"
            Cbotaikhoan_ts.HighlightBorderColor = Color.Black
            Cbotaikhoan_ts.GridLineHorizontal = True
            Cbotaikhoan_ts.GridLineVertical = True
            Cbotaikhoan_ts.ItemHeight = 17
            Cbotaikhoan_ts.DropDownHeight = 300
            Cbotaikhoan_ts.SourceDataTable = moduleDatabaseConn.GetDataTable(sqlQuery)
            Cbotaikhoan_ts.SelectedIndex = 0
            ' Load TK KH
            Cbotaikhoan_kh.Items.Clear()
            Cbotaikhoan_kh.LoadingType = MTGCComboBox.CaricamentoCombo.DataTable
            Cbotaikhoan_kh.ColumnNum = 2
            Cbotaikhoan_kh.ColumnWidth = "150;300"
            Cbotaikhoan_kh.HighlightBorderColor = Color.Black
            Cbotaikhoan_kh.GridLineHorizontal = True
            Cbotaikhoan_kh.GridLineVertical = True
            Cbotaikhoan_kh.ItemHeight = 17
            Cbotaikhoan_kh.DropDownHeight = 300
            Cbotaikhoan_kh.SourceDataTable = moduleDatabaseConn.GetDataTable(sqlQuery)
            Cbotaikhoan_kh.SelectedIndex = 0
            ' Load TK CP
            Cbotaikhoan_cp.Items.Clear()
            Cbotaikhoan_cp.LoadingType = MTGCComboBox.CaricamentoCombo.DataTable
            Cbotaikhoan_cp.ColumnNum = 2
            Cbotaikhoan_cp.ColumnWidth = "150;300"
            Cbotaikhoan_cp.HighlightBorderColor = Color.Black
            Cbotaikhoan_cp.GridLineHorizontal = True
            Cbotaikhoan_cp.GridLineVertical = True
            Cbotaikhoan_cp.ItemHeight = 17
            Cbotaikhoan_cp.DropDownHeight = 300
            Cbotaikhoan_cp.SourceDataTable = moduleDatabaseConn.GetDataTable(sqlQuery)
            Cbotaikhoan_cp.SelectedIndex = 0
        Catch ex As Exception
        End Try
    End Sub

    Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
        Dim iRow As Integer = Me.DataGridView1.CurrentRow.Index
        If iRow >= 0 Then
            Me.txtma.Text = Me.DataGridView1.Item(Me.colma.Index, iRow).Value
            Me.txtten.Text = Me.DataGridView1.Item(Me.colten.Index, iRow).Value
            Me.cbomanhom.Text = Me.DataGridView1.Item(Me.colmanhom.Index, iRow).Value
            Me.txttennhom.Text = Me.DataGridView1.Item(Me.coltennhom.Index, iRow).Value
            Me.cbomapb.Text = Me.DataGridView1.Item(Me.colmapb.Index, iRow).Value
            Me.txttenpb.Text = Me.DataGridView1.Item(Me.coltenpb.Index, iRow).Value
            Me.txtnuocsx.Text = Me.DataGridView1.Item(Me.colnuocsx.Index, iRow).Value
            Me.txtnguyengia.Text = Format(CDec(Me.DataGridView1.Item(Me.colnguyengia.Index, iRow).Value), "N0")
            Me.txttylekh.Text = Format(CDec(Me.DataGridView1.Item(Me.coltylekh.Index, iRow).Value), "N2")
            Me.txtmuckh.Text = Format(CDec(Me.DataGridView1.Item(Me.colmuckh.Index, iRow).Value), "N0")
            Me.txtsokykh.Text = Me.DataGridView1.Item(Me.colsokykh.Index, iRow).Value
            Me.txtngaysd.Text = Me.DataGridView1.Item(Me.colngaysd.Index, iRow).Value
            Me.txtthang_dau_kh.Text = Me.DataGridView1.Item(Me.colthang_dau_kh.Index, iRow).Value
            Me.Cbotaikhoan_ts.Text = Me.DataGridView1.Item(Me.coltaikhoan_ts.Index, iRow).Value
            Me.Cbotaikhoan_kh.Text = Me.DataGridView1.Item(Me.coltaikhoan_kh.Index, iRow).Value
            Me.Cbotaikhoan_cp.Text = Me.DataGridView1.Item(Me.coltaikhoan_cp.Index, iRow).Value
            Me.txtghichu.Text = Me.DataGridView1.Item(Me.colghichu.Index, iRow).Value
            Me.txtDVT.Text = Me.DataGridView1.Item(Me.coldvt.Index, iRow).Value
        End If
    End Sub
    Private Sub btn_cbo_nhom_taisan_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_cbo_nhom_taisan.Click
        co_tuoi = 1
        frmTS_NhomTS.Show()
    End Sub
    Private Sub btn_cbo_mapb_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_cbo_mapb.Click
        co_tuoi = 2
        frmTS_Phongban.Show()
    End Sub
    Private Sub btn_cbo_taikhoan_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_cbo_taikhoan.Click
        co_tuoi = 3
        ' frmtieukhoan.co_quyen = 1
        frmtieukhoan.Show()
    End Sub

    Private Sub cbomanhom_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbomanhom.SelectedIndexChanged
        Try
            Me.txttennhom.Text = Me.cbomanhom.SelectedItem.Col2
        Catch ex As Exception
            Me.txttennhom.Text = ""
        End Try
    End Sub

    Private Sub cbomapb_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbomapb.SelectedIndexChanged
        Try
            Me.txttenpb.Text = Me.cbomapb.SelectedItem.Col2
        Catch ex As Exception
            Me.txttenpb.Text = ""
        End Try
    End Sub
    Private Sub txtnguyengia_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtnguyengia.LostFocus
        Try
            Me.txtnguyengia.Text = Format(CDec(Me.txtnguyengia.Text), "N0")
            Me.txtsokykh.Focus()
        Catch ex As Exception
        End Try

    End Sub
    Private Sub txtsokykh_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtsokykh.TextChanged
        Try
            Me.txtmuckh.Text = Format(Math.Round(CDec(Me.txtnguyengia.Text) / CDec(Me.txtsokykh.Text), 2), "N0")
            Me.txttylekh.Text = Format((CDec(Me.txtmuckh.Text) / CDec(Me.txtnguyengia.Text)) * 100, "N2")
        Catch ex As Exception

        End Try

    End Sub
    Private Sub txtmuckh_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtmuckh.LostFocus
        Try
            Me.txtmuckh.Text = Format(CDec(Me.txtmuckh.Text), "N0")
        Catch ex As Exception

        End Try

    End Sub

    Private Sub txttylekh_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txttylekh.LostFocus
        Try
            Me.txttylekh.Text = Format(CDec(Me.txttylekh.Text), "N2")
        Catch ex As Exception
        End Try
    End Sub

    Private Sub Btn_Edit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Btn_Edit.Click
        Me.setReadonly(False, True, True)
    End Sub
    Private Sub Btn_Lamtuoi_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Btn_Lamtuoi.Click
        If co_tuoi = 1 Then
            Me.loadNhomTS()
        End If
        If co_tuoi = 2 Then
            Me.loadPhongban()
        End If
        If co_tuoi = 3 Then
            Me.loadTaikhoan()
        End If
        If co_tuoi = 0 Then
            Me.loadDanhSachNhomHangHoa("SELECT * FROM TS_taisan")
        End If
    End Sub
End Class


